package com.tcat.search.pojo;

import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.util.Date;
import java.util.Map;
import java.util.Set;

@Document(indexName = "goods", type = "docs", shards = 1, replicas = 0)
@Data
public class Goods {
    @Id
    private Long id;   //spuId
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String all;   //所有需要被搜索的信息，包括标题，分类，甚至品牌  搜索字段
    @Field(type = FieldType.Keyword, index = false)        //不根据这个字段搜索，仅仅用来展示
    private String subTitle;
    private Long brandId;
    private Long cid1;
    private Long cid2;
    private Long cid3;
    private Date createTime;    //新品过滤
    private Set<Long> price;     //价格过滤，集合对应json中是数组 ，因为spu下有多个sku，每个sku价格都不同
    @Field(type = FieldType.Keyword, index = false)          //展示字段
    private String skus;    //sku信息的json结构
    private Map<String,Object> specs;   //可搜索的规格参数
    //{"机身内存" :"4GB"}   specs.机身内容.keyword:keyword

}
